// import VueRouter from 'vue-router'
// import Vue from 'vue'
import {createRouter, createWebHistory} from 'vue-router'
import Article from '../views/Article.vue'
import Interest from '../views/Interest.vue'
import Problem from '../views/Problem.vue'
import ArticleEdit from '../views/ArticleEdit.vue'
import ArticleDetail from '../views/ArticleDetail.vue'
import ProblemEdit from '../views/ProblemEdit.vue'
import ProblemDetail from '../views/ProblemDetail.vue'
import User from '../views/User.vue'

// Vue.use(VueRouter)
// const router = new VueRouter({
const router = new createRouter({
  history: createWebHistory(),
  routes: [
    { //默认文章页
      path: '/',
      redirect: '/article'
    },
    { //文章页
      path: '/article',
      name: 'Article',
      component: Article
    },
    { //关注页
      path: '/interest',
      name: 'Interest',
      component: Interest
    },
    { //问答页
      path: '/problem',
      name: 'Problem',
      component: Problem
    },
    { //个人主页
      path: '/user/:userId',
      name: 'User',
      component: User
    },
    { //写文章
      path: '/article/editor',
      name: 'ArticleEdit',
      component: ArticleEdit
    },
    { //编辑自己的文章
      path: '/article/editor/:articleId',
      name: 'MyArticleEdit',
      component: ArticleEdit
    },
    { //查看文章详情
      path: '/article/:articleId',
      name: 'ArticleDetail',
      component: ArticleDetail
    },
    { //提问题
      path: '/problem/editor',
      name: 'ProblemEdit',
      component: ProblemEdit
    },
    { //编辑自己的问题
      path: '/problem/editor/:problemId',
      name: 'MyProblemEdit',
      component: ProblemEdit
    },
    { //查看问题详情
      path: '/problem/:problemId',
      name: 'ProblemDetail',
      component: ProblemDetail
    }
  ]
})

export default router